home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d18
/
turbotut.arc
/
IFDEMO.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-06-30
|
999b
|
39 lines
PROGRAM demonstrate_conditional_branching;
VAR one,two,three : INTEGER;
BEGIN (* main program *)
one := 1; (* these are to have some numbers *)
two := 2; (* to use for illustrations *)
three := 3;
IF three = (one + two) THEN (* Example 1 *)
WRITELN('three is equal to one plus two');
IF three = 3 THEN (* Example 2 *)
BEGIN
WRITE('three is ');
WRITE('equal to ');
WRITE('one plus two');
WRITELN;
END;
IF two = 2 THEN (* Example 3 *)
WRITELN('two is equal to 2 as expected')
ELSE
WRITELN('two is not equal to 2... rather strange');
IF two = 2 THEN (* Example 4 *)
IF one = 1 THEN
WRITELN('one is equal to one')
ELSE
WRITELN('one is not equal to one')
ELSE
IF three = 3 THEN
WRITELN('three is equal to three')
ELSE
WRITELN('three is not equal to three');
END. (* main program *)